home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2004 June
/
Chip_2004-06_cd1.bin
/
software
/
tsw
/
tsw.exe
/
{app}
/
scripts
/
converttohtmlchars.tss
< prev
next >
Wrap
Text File
|
2003-07-09
|
957b
|
46 lines
{
[Scriptsettings]
Scriptname=Convert <> chars to HTML codes
ExecuteOnStartup=0
ExecuteOnlyOnce=0
}
program MyScript;
function StringReplace(S, OldPattern, NewPattern: string): string;
var
SearchStr, Patt, NewStr: string;
Offset: Integer;
begin
SearchStr := S;
Patt := OldPattern;
NewStr := S;
Result := '';
while SearchStr <> '' do
begin
Offset := Pos(Patt, SearchStr);
if Offset = 0 then
begin
Result := Result + NewStr;
Break;
end;
Result := Result + Copy(NewStr, 1, Offset - 1) + NewPattern;
NewStr := Copy(NewStr, Offset + Length(OldPattern), 2147483647);
SearchStr := Copy(SearchStr, Offset + Length(Patt), 2147483647);
end;
end;
function ConvertIt(s: string) : string;
begin
s := StringReplace(s, '<', '<');
s := StringReplace(s, '>', '>');
Result := s;
end;
var
Code: string;
begin
Code := GetText;
SetText(ConvertIt(Code));
end.